package com.mini.client;

import com.mini.vo.BusinessResult;
import com.mini.vo.DeptVO;
import com.mini.vo.FullDeptVo;
import com.mini.vo.UserVO;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Set;

/**
 * @author zhangxiaobin
 * @title: MiniAdminClient
 * @description: TODO
 * @date 2020/2/714:22
 */
@FeignClient(name = "mini-admin", url = "${mini.remote-url.mini-admin}")
public interface MiniAdminClient {


    /**
     * 获取用户登录信息
     *
     * @param Authorization
     * @return
     */
    @GetMapping(value = "/auth/checkLogin")
    BusinessResult<UserVO> checkLogin(@RequestHeader(value = "Authorization") String Authorization);

    /**
     * 按组织查询从当前组织到顶级所有的角色化组织
     *
     * @param deptId
     * @return
     */
    @GetMapping(value = "/api/dept/parents/full/{id}")
    BusinessResult<FullDeptVo> findFullDept(@RequestHeader("sig") String sig, @PathVariable("id") Long deptId);

    /**
     * 批量查询组织信息
     *
     * @param sig
     * @param deptIds
     * @return
     */
    @PostMapping(value = "/api/dept/byDeptIds")
    BusinessResult<List<DeptVO>> getDeptsBatch(@RequestHeader("sig") String sig, @RequestBody Set<Long> deptIds);


    /**
     * 查询用户简版信息，包括用户所在组织到顶级所有的角色化组织
     *
     * @param sig
     * @param userId
     * @return
     */
    @GetMapping(value = "/api/users/simpleInfo")
    BusinessResult<UserVO> getUserSimpleInfo(@RequestHeader("sig") String sig, @RequestParam(value = "userId") Long userId);


    /**
     * 批量查询用户简版信息
     *
     * @param sig
     * @param userIds
     * @return
     */
    @PostMapping(value = "/api/users/batch/simpleInfo")
    BusinessResult<List<UserVO>> batchFindUserList(@RequestHeader("sig") String sig, @RequestBody Set<Long> userIds);


    /**
     * 查询父组织
     *
     * @param sig
     * @param deptId
     * @return
     */
    @GetMapping(value = "/api/dept/parents/{id}")
    BusinessResult<DeptVO> getParentDept(@RequestHeader("sig") String sig, @PathVariable("id") Long deptId);

    /**
     * 查询儿子组织
     *
     * @param deptId
     * @return
     */
    @GetMapping(value = "/api/dept/childs/son/{id}")
    BusinessResult<List<DeptVO>> getSonDeptList(@RequestHeader("sig") String sig, @PathVariable("id") Long deptId);


    /**
     * 查询当前组织任意级别的直系亲属组织
     *
     * @param deptId
     * @param level
     * @return
     */
    @GetMapping(value = "/api/depts/level/{id}")
    BusinessResult<List<DeptVO>> getDirectRelativeDepts(@RequestHeader("sig") String sig, @PathVariable("id") Long deptId,
                                                        @RequestParam(value = "level") Integer level);


    /**
     * 按组织和级别查询当前组织下的某一级别组织列表
     *
     * @param id
     * @param level
     * @return
     */
    @GetMapping(value = "/api/dept/childs/{id}/{level}")
    BusinessResult<List<DeptVO>> findChildDepts(@RequestHeader("sig") String sig,
                                                @PathVariable("id") Long deptId,
                                                @PathVariable("level") Integer level);

    /**
     * 根据登录人权限查看工作室(量子军团)集合
     *
     * @param Authorization
     * @return
     */
    @GetMapping(value = "/api/dept/scoped/operation/workroom/linear")
    BusinessResult<List<DeptVO>> getWorkRoomDeptList(@RequestHeader("Authorization") String Authorization);

    /**
     * 根据登录人权限查看登录人可以查看的量子军团的权限，比如咨询师，返回为空，不能查看任何量子军团
     *
     * @param Authorization
     * @return
     */
    @GetMapping(value = "/api/dept/scoped/operation/child/workroom/linear")
    BusinessResult<List<DeptVO>> getChildWorkRoomDeptList(@RequestHeader("Authorization") String Authorization);

    /**
     * 权限范围内的项目专员
     *
     * @param userId
     * @return
     */
    @GetMapping(value = "/api/users/scopedAdvertisingUserIds")
    BusinessResult<List<Long>> scopedAdvertisingUserIds(@RequestHeader("sig") String sig, @RequestParam(value = "userId") Long userId);

    /**
     * 权限范围内运营专员(咨询师)/组长基础信息
     *
     * @param Authorization
     * @return
     */
    @GetMapping(value = "/api/users/scopedOperationUserList")
    BusinessResult<List<UserVO>> scopedOperationUserList(@RequestHeader(value = "Authorization") String Authorization);

    /**
     * 权限范围内运营专员(咨询师)/组长
     *
     * @param userId
     * @return
     */
    @GetMapping(value = "/api/users/scopedOperationUserIds")
    BusinessResult<List<Long>> scopedOperationUserIds(@RequestHeader("sig") String sig, @RequestParam(value = "userId") Long userId);

    /**
     * 权限范围内运营专员(咨询师)/组长，包括历史接线
     *
     * @param userId
     * @return
     */
    @GetMapping(value = "/api/users/scopedOperationUserIds/history")
    BusinessResult<List<Long>> scopedOperationUserIdsHistory(@RequestHeader("sig") String sig, @RequestParam(value = "userId") Long userId);


    /**
     * 根据任意组织查用户权限范围内的运营组
     *
     * @param deptIds
     * @return
     */
    @PostMapping(value = "/api/dept/linear/operation/filter")
    BusinessResult<List<DeptVO>> findOperatDepts(@RequestHeader("sig") String sig, @RequestBody Set<Long> deptIds, @RequestParam(value = "userId") Long userId);

    /**
     * 按任意组织查询登录用户权限范围内的运营专员(咨询师)/组长简版信息列表
     *
     * @param Authorization
     * @param deptIds
     * @return
     */
    @PostMapping(value = "/api/users/scoped/operation/filter")
    BusinessResult<List<UserVO>> operationUserFilter(@RequestHeader(value = "Authorization") String Authorization, @RequestBody Set<Long> deptIds);

    /**
     * 按任意组织查询登录用户权限范围内的正在接线的运营专员(咨询师)/组长简版信息列表
     *
     * @param Authorization
     * @param deptIds
     * @return
     */
    @PostMapping(value = "/api/users/scoped/operation/filter/valid")
    BusinessResult<List<UserVO>> operationUserFilterValid(@RequestHeader(value = "Authorization") String Authorization, @RequestBody Set<Long> deptIds);


    /**
     * 权限范围内的投放工作室
     *
     * @param Authorization
     * @return
     */
    @GetMapping(value = "/api/dept/linear/advertising")
    BusinessResult<List<DeptVO>> advertisingDepts(@RequestHeader(value = "Authorization") String Authorization);

    /**
     * 根据登录人权限查看量子军团长集合
     *
     * @param Authorization
     * @return
     */
    @GetMapping(value = "/api/users/scopedSOPUserIds")
    BusinessResult<List<Long>> scopedSOPUserIds(@RequestHeader(value = "Authorization") String Authorization);
}

